<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="../../lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../../lib/Validform/5.3.2/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../ht-css/Project.css"/>
    <!--引入分页-->
    <link rel="stylesheet" href="../../lib/pagination/pagination.css">
    <!--[if IE 6]>
    <script type="text/javascript" src="../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../ht-css/style-q.css"/>
    <link rel="stylesheet" href="../../ht-css/combo.select.css">
    <script src="../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../ht-js/verifyToken.js?rev=@@hash"></script>
    <title>商品管理</title>
    <style type="text/css">
        .box {
            width: 800px;
            height: 380px;
            /*background: ;*/
            border: 5px solid whitesmoke;
            /*padding: ;
            margin: ;*/
            padding: 30px 80px 350px 80px;
            /*background: wheat;*/
            margin: 50px auto;
        }

        .tab {
            width: 100%;
        }

        tr {
            border-bottom: #333 1px dashed;
            border-right: #333 1px dashed;
            border-left: #333 1px dashed;
            border-top: #333 1px dashed;

        }

        td {
            padding: 5px;
            text-align: center;
        }
    </style>

    <!--<link href="global.css" rel="stylesheet" type="text/css" />-->
    <style media="print" type="text/css">
        .Noprint {
            display: none;
        }

        .PageNext {
            page-break-after: always;
        }

        .tblPrint {
            border: none;
        }

        .guanlian {
            position: absolute;
            top: 35px;
            width: 148px;
            overflow-y: scroll;
            max-height: 150px;
            display: block;
            z-index: 1;
        }

        .guanlian li {
            text-indent: 20px;
        }

        #loding {
            width: 200px;
            height: 100px;
            background: red;
            float: left;
        }
    </style>

</head>
<body data-id="34">
<nav class="breadcrumb">商品管理 <span class="c-gray en">&gt;</span> 导入导出 <a class="btn btn-success radius r"
                                                                         style="line-height:1.6em;margin-top:3px"
                                                                         href="javascript:location.replace(location.href);"
                                                                         title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<article class="page-container">
    <div class="ml-20 mr-20" id="form-member-add" method="post">
        <div id="tab_topnav" class="HuiTab">
            <div class="tabBar clearfix"><span>导入/导出</span>
                <div class="box">
                    <table class="tab">
                        </tr>
                        <td>
                            <div class="divClass" style="position:relative;">
                                <div><h4>商品品类导入待开放</h4></div>
                                <form method="post" enctype="multipart/form-data">
                                    <input type="file" id="upCategoryfile" class="powerButton 412"/>
                                    <!--<input id="upCategoryLoad" type="button" value="上传文件">-->
                                    <div>
                                        <!--<button type="button" class="hui-button hui-button-large mt-15 mb-15"
                                                id="upCategoryLoad">
                                            文件上传
                                        </button>-->
                                        <img id="categoryLoding" style="display: none" class="img-loading"
                                             src="../../img/f096f4ca2bfdd4ab03d0b040f959ebef.gif" title="上传中...">
                                    </div>
                                </form>
                            </div>
                        </td>
                        <td style="border-left: #333 1px dashed">
                            <!--导出excel-->
                            <div><h4>商品品类导出</h4></div>
                            <form method="get">
                                <input type="button" id="dwCategoryLoad" value="商品品类下载导入模板"/>
                            </form>
                        </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="divClass">
                                    <div><h4>商品导入</h4></div>
                                    <form method="post" enctype="multipart/form-data">
                                        <input type="file" id="upProductFile"/>
                                        <!--<input id="upProductLoad" type="button" value="上传文件">-->
                                        <div>
                                            <button type="button" class="hui-button hui-button-large mt-15 mb-15 powerButton 413"
                                                    id="upProductLoad">
                                                文件上传
                                            </button>
                                            <img id="productLoding" class="img-loading" style="display: none"
                                                 src="../../img/f096f4ca2bfdd4ab03d0b040f959ebef.gif" title="上传中...">
                                        </div>
                                    </form>
                                </div>
                            </td>
                            <td style="border-left: #333 1px dashed">
                                <!--导出excel-->
                                <div><h4>商品导出</h4></div>
                                <form method="post">
                                    <input type="button" id="dwProductLoad"
                                           value="商品下载导入模板"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button"
                                                                                            id="dwErrorProductLoad"
                                                                                            value="导入异常商品下载"/>
                                </form>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="divClass">
                                    <div><h4>商品品牌导入</h4></div>
                                    <form method="post" enctype="multipart/form-data">
                                        <input type="file" id="upBrandFile"/>
                                        <!--<input id="upBrandLoad" type="button" value="上传文件">-->
                                        <div>
                                            <button type="button" class="hui-button hui-button-large mt-15 mb-15 powerButton 414"
                                                    id="upBrandLoad">
                                                文件上传
                                            </button>
                                            <img id="brandLoding" style="display: none" class="img-loading"
                                                 src="../../img/f096f4ca2bfdd4ab03d0b040f959ebef.gif" title="上传中...">
                                        </div>
                                    </form>
                                </div>
                            </td>
                            <td style="border-left: #333 1px dashed">
                                <!--导出excel-->
                                <div><h4>商品品牌导出</h4></div>
                                <form method="post">
                                    <input type="button" id="dwBrandLoad" value="品牌下载导入模板"/>
                                </form>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="divClass">
                                    <div><h4>商品属性导入</h4></div>
                                    <form method="post" enctype="multipart/form-data">
                                        <input type="file" id="upAttrnuteFile"/>
                                        <!--<input id="upAttrnuteLoad" type="button" value="上传文件">-->
                                        <div>
                                            <button type="button" class="hui-button hui-button-large mt-15 mb-15 powerButton 415"
                                                    id="upAttrnuteLoad">
                                                文件上传
                                            </button>
                                            <img id="attrLoding" class="img-loading" style="display: none"
                                                 src="../../img/f096f4ca2bfdd4ab03d0b040f959ebef.gif" title="上传中...">
                                        </div>
                                    </form>
                                </div>
                            </td>
                            <td style="border-left: #333 1px dashed">
                                <!--导出excel-->
                                <div><h4>商品属性导出</h4></div>
                                <form method="post">
                                    <input type="button" id="dwAttrnuteLoad" value="属性项下载导入模板"/>
                                </form>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="divClass">
                                    <div><h4>指定展示价和锁价类型导入</h4></div>
                                    <form method="post" enctype="multipart/form-data">
                                        <input type="file" id="upSkuPriceTypeFile"/>
                                        <div>
                                            <button type="button" class="hui-button hui-button-large mt-15 mb-15 powerButton 416"
                                                    id="upSkuPriceTypeFileLoad">
                                                文件上传
                                            </button>
                                            <img id="skuSkuPriceTypeLoding" class="img-loading" style="display: none"
                                                 src="../../img/f096f4ca2bfdd4ab03d0b040f959ebef.gif" title="上传中...">
                                        </div>
                                    </form>
                                </div>
                            </td>
                            <td style="border-left: #333 1px dashed">
                                <div><h4>指定展示价和锁价类型导出</h4></div>
                                <form method="post">
                                    <input type="button" id="dwSkuPriceTypeFileLoad" value="指定展示价和锁价类型下载导入模板"/>
                                </form>
                            </td>
                        </tr>

                        <!--指定交易价锁价类型导入-->
                        <tr>
                            <td>
                                <div class="divClass">
                                    <div><h4>指定交易价格锁价类型导入</h4></div>
                                    <form method="post" enctype="multipart/form-data">
                                        <input type="file" id="upSkuTranPriceTypeFile"/>
                                        <div>
                                            <button type="button" class="hui-button hui-button-large mt-15 mb-15 powerButton 417"
                                                    id="upSkuTranPriceTypeFileLoad">
                                                文件上传
                                            </button>
                                            <img id="skuSkuTranPriceTypeLoding" class="img-loading"
                                                 style="display: none"
                                                 src="../../img/f096f4ca2bfdd4ab03d0b040f959ebef.gif" title="上传中...">
                                        </div>
                                    </form>
                                </div>
                            </td>
                            <td style="border-left: #333 1px dashed">
                                <div><h4>指定交易价格锁价类型导出</h4></div>
                                <form method="post">
                                    <input type="button" id="dwSkuTranPriceTypeFileLoad" value="指定交易价格锁价类型下载导入模板"/>
                                </form>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <div class="divClass">
                                    <div><h4>库存初始化</h4></div>
                                    <div>
                                        <button type="button" class="hui-button hui-button-large mt-15 mb-15 powerButton 418"
                                                id="initStockLoad">
                                            库存初始化
                                        </button>
                                        <img id="stockInitLoding" class="img-loading" style="display: none"
                                             src="../../img/f096f4ca2bfdd4ab03d0b040f959ebef.gif" title="库存初始化中...">
                                    </div>
                                </div>
                            </td>
                            <td style="border-left: #333 1px dashed">
                                <div class="divClass">
                                    <div><h4>价格初始化</h4></div>
                                    <div>
                                        <button type="button" class="hui-button hui-button-large mt-15 mb-15 powerButton 419"
                                                id="initPriceLoad">
                                            价格初始化
                                        </button>
                                        <img id="initPriceLoding" class="img-loading" style="display: none"
                                             src="../../img/f096f4ca2bfdd4ab03d0b040f959ebef.gif" title="价格初始化中...">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="divClass">
                                    <div><h4>商品批量上下架导入</h4></div>
                                    <form method="post" enctype="multipart/form-data">
                                        <input type="file" id="upSkuShelfTypeFile"/>
                                        <div>
                                            <button type="button" class="hui-button hui-button-large mt-15 mb-15 powerButton 420"
                                                    id="upSkuShelfTypeFileLoad">
                                                文件上传
                                            </button>
                                            <img id="skuSkuShelfTypeLoding" class="img-loading" style="display: none"
                                                 src="../../img/f096f4ca2bfdd4ab03d0b040f959ebef.gif" title="上传中...">
                                        </div>
                                    </form>
                                </div>
                            </td>
                            <td style="border-left: #333 1px dashed">
                                <!--导出excel-->
                                <div><h4>导入商品详情下载</h4></div>
                                <form method="post">
                                    <input type="button" id="dwSkuShelfTypeFileLoad" value="批量上下架导入商品详情下载" class="powerButton 421"/>
                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                    <input type="button" id="dwshelfModule" value="下载批量上下架商品模板" class="powerButton 421"/>
                                </form>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <div class="divClass">
                                    <div><h4>商品最小起订量导入</h4></div>
                                    <form method="post" enctype="multipart/form-data">
                                        <input type="file" id="upSkuMiniOrderFile"/>
                                        <div>
                                            <button type="button" class="hui-button hui-button-large mt-15 mb-15 powerButton 413"
                                                    id="upSkuMiniOrderLoad">
                                                文件上传
                                            </button>
                                            <img id="SkuMiniOrderLoding" class="img-loading" style="display: none"
                                                 src="../../img/f096f4ca2bfdd4ab03d0b040f959ebef.gif" title="上传中...">
                                        </div>
                                    </form>
                                </div>
                            </td>
                            <td style="border-left: #333 1px dashed">
                                <!--导出excel-->
                                <div><h4>商品最小起订量导出</h4></div>
                                <form method="post">
                                    <input type="button" id="dwSkuMiniOrderLoad"
                                           value="最小起订量模板下载"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button"
                                                                                             id="dwErrorSkuMiniOrderLoad"
                                                                                             value="最小起订量错误结果下载"/>
                                </form>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div id="dizhi" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="ture"
         style="border-radius: 8px;">
        <div class="modal-dialog">
            <div class="modal-content radius" style="width:330px;margin-top: 50%;margin-left: 22%">
                <div style="width:330px;">
                    <div class="modal-header" style="width: 90%;height: 5px">
                        <span class="modal-title"><b class="addressTitle"
                                                     style="height:10px;margin-top: 0px">提示</b></span>
                        <a class="close" style="margin-right: 5px;width: 22px;height: 10px;margin-top: 0px"
                           data-dismiss="modal" aria-hidden="true">×</a>
                    </div>
                    <div>
                        <div class="pos-r mt-20 mb-20" style="z-index: 900;">
                            <div class="text-c" style="width:325px;height:99px;overflow:auto">
                                <span id="dataMessage" style="font-size: 18px"></span>
                            </div>

                            <div id="dataTr" style="border: 0px;display: none;">
                                <input type="text" autocomplete="off" class="input-text radius pd-5 ml-20 lh-30"
                                       name="class2" readonly="readonly" id="class" style="width:89%;height:30px;"
                                       value="异常数据">
                                <div id="dataUl" class="bk-gray mt-20 ml-20 mr-20 mb-40"
                                     style="height:180px;overflow-y:auto; overflow-x: hidden">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</article>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script type="text/javascript" src="../../ht-js/frame/doT.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/jquery.combo.select.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../lib/Validform/5.3.2/Validform_v5.3.2_min.js?rev=@@hash"></script>
<script src="../../lib/pagination/jquery.pagination.js?rev=@@hash"></script>
<script src="../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../ht-js/verifyToken.js?rev=@@hash"></script>
<script type="text/javascript" src="../../ht-js/power.js?rev=@@hash"></script>
<script type="text/javascript">
    /*上传excel文件*/
    $(function () {
        $(".close").click(function () {
            $("#dataTr").hide();
            //清空ul下的li标签
            $("ul").find("li").remove();
        });
        //获取用户信息
        var localStorageParameters = decodeURIComponent(web.readCookie("loginData"));
        var JsonObject = JSON.parse(localStorageParameters);

        /*品类上传*/
        $('#upCategoryLoad').click(function () {
            if (!$("#categoryLoding").is(":hidden")) {
                $("#dizhi").modal("show");
                $("#dataMessage").html("文件上传未结束...");
                return;
            }
            var formData = new FormData();
            var name = $("#upCategoryfile").val();//文件名称
            formData.append("file", $("#upCategoryfile")[0].files[0]);
            formData.append("creationBy", JsonObject.user.user_ID);
            formData.append("lastModifiedBy", JsonObject.user.user_ID);
            formData.append("creationBy", JsonObject.user.user_ID);
            if ($("#upCategoryfile")[0].files[0] == null || $("#upCategoryfile")[0].files[0] == '') {
                $("#dizhi").modal("show");
                $("#dataMessage").html("请选择上传的Excel文件!");
                return;
            } else {
                var result = /\.[^\.]+/.exec(name);
                if (result != ".xlsx" && result != ".xls") {
                    $("#dizhi").modal("show");
                    $("#dataMessage").html("上传的文件格式错误，请传递*.xlsx或*.xls格式文件!");
                    return;
                }
                $.ajax({
                    url: root.goodsInter.goods_importAllCategory,
                    type: "POST",
                    contentType: 'multipart/form-data',
                    data: formData,
                    // 告诉jQuery不要去处理发送的数据
                    processData: false,
                    // 告诉jQuery不要去设置Content-Type请求头
                    contentType: false,
                    beforeSend: function () {
                        $("#categoryLoding").show();
                    },
                    success: function (data) {
                        //隐藏加载图片
                        $("#categoryLoding").hide();
                        if (data.errorCode == 0) {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html("上传成功");
                        } else {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html(data.errorMessage);
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $("#categoryLoding").hide();
                        //请求出错处理
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("系统服务异常!");
                    }
                })
            }
        });

        /*品类下载*/
        $("#dwCategoryLoad").click(function () {
            window.location.href = root.goodsInter.goods_expCategoryModel;
        });

        /*品牌上传*/
        $('#upBrandLoad').click(function () {
            if (!$("#brandLoding").is(":hidden")) {
                $("#dizhi").modal("show");
                $("#dataMessage").html("文件上传未结束...");
                return;
            }
            var formData = new FormData();
            var name = $("#upBrandFile").val();//文件名称
            formData.append("file", $("#upBrandFile")[0].files[0]);
            formData.append("creationBy", JsonObject.user.user_ID);
            formData.append("lastModifiedBy", JsonObject.user.user_ID);
            if ($("#upBrandFile")[0].files[0] == null || $("#upBrandFile")[0].files[0] == '') {
                $("#dizhi").modal("show");
                $("#dataMessage").html("请选择上传的Excel文件!");
                return;
            } else {
                var result = /\.[^\.]+/.exec(name);
                if (result != ".xlsx" && result != ".xls") {
                    $("#dizhi").modal("show");
                    $("#dataMessage").html("上传的文件格式错误，请传递*.xlsx或*.xls格式文件!");
                    return;
                }
                $.ajax({
                    url: root.goodsInter.goods_brandImport,
//                    url:"http://localhost:7052/aproduct/brand/brandImport",
                    type: "POST",
                    contentType: 'multipart/form-data',
                    data: formData,
                    // 告诉jQuery不要去处理发送的数据
                    processData: false,
                    // 告诉jQuery不要去设置Content-Type请求头
                    contentType: false,
                    beforeSend: function () {
                        $("#brandLoding").show();
                    },
                    success: function (data) {
                        $("#brandLoding").hide();
                        if (data.errorCode == 0) {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html("导入成功");
                        } else {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html(data.errorMessage);
                            if (data.error != null && data.error.length > 0) {
                                $.each(data.error, function (i, j) {
                                    $("#dataUl").append('<div class="il-b pt-5 pb-5 pl-10 pr-10" style="width:100%;"><span class="il-b f-14">' + j + '</span></div>');
                                })
                                $("#dataUl div").hover(function () {
                                    //移入
                                    $(this).css("background", "#e7e7e7");
                                }, function () {
                                    //移除
                                    $(this).css("background", "white");
                                });
                                $("#dataTr").show();
                            }
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $("#brandLoding").hide();
                        //请求出错处理
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("系统服务异常!");
                    }
                })
            }
        });

        /*品牌下载*/
        $("#dwBrandLoad").click(function () {
            window.location.href = root.goodsInter.goods_exportBrand;
        });


        /*属性上传*/
        $('#upAttrnuteLoad').click(function () {
            if (!$("#attrLoding").is(":hidden")) {
                $("#dizhi").modal("show");
                $("#dataMessage").html("文件上传未结束...");
                return;
            }
            var formData = new FormData();
            var name = $("#upAttrnuteFile").val();//文件名称
            formData.append("file", $("#upAttrnuteFile")[0].files[0]);
            formData.append("creationBy", JsonObject.user.user_ID);
            formData.append("lastModifiedBy", JsonObject.user.user_ID);
            if ($("#upAttrnuteFile")[0].files[0] == null || $("#upAttrnuteFile")[0].files[0] == '') {
                $("#dizhi").modal("show");
                $("#dataMessage").html("请选择上传的Excel文件!");
                return;
            } else {
                var result = /\.[^\.]+/.exec(name);
                if (result != ".xlsx" && result != ".xls") {
                    $("#dizhi").modal("show");
                    $("#dataMessage").html("上传的文件格式错误，请传递*.xlsx或*.xls格式文件!");
                    return;
                }
                $.ajax({
                    url: root.goodsInter.goods_importAllAttribute,
                    type: "POST",
                    contentType: 'multipart/form-data',
                    data: formData,
                    // 告诉jQuery不要去处理发送的数据
                    processData: false,
                    // 告诉jQuery不要去设置Content-Type请求头
                    contentType: false,
                    beforeSend: function () {
                        $("#attrLoding").show();
                    },
                    success: function (data) {
                        $("#attrLoding").hide();
                        if (data.errorCode == 0) {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html("导入成功");
                        } else {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html(data.errorMessage);
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $("#attrLoding").hide();
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("系统服务异常!");
                    }
                })
            }
        });

        /*属性下载*/
        $("#dwAttrnuteLoad").click(function () {
            window.location.href = root.goodsInter.goods_exportAttribute;
        });

        /*商品上传*/
        $('#upProductLoad').click(function () {
            if (!$("#productLoding").is(":hidden")) {
                $("#dizhi").modal("show");
                $("#dataMessage").html("文件上传未结束...");
                return;
            }
            var formData = new FormData();
            var name = $("#upProductFile").val();//文件名称
            formData.append("file", $("#upProductFile")[0].files[0]);
            formData.append("creationBy", JsonObject.user.user_ID);
            formData.append("lastModifiedBy", JsonObject.user.user_ID);
            if ($("#upProductFile")[0].files[0] == null || $("#upProductFile")[0].files[0] == '') {
                $("#dizhi").modal("show");
                $("#dataMessage").html("请选择上传的Excel文件!");
                return;
            } else {
                var result = /\.[^\.]+/.exec(name);
                if (result != ".xlsx" && result != ".xls") {
                    $("#dizhi").modal("show");
                    $("#dataMessage").html("上传的文件格式错误，请传递*.xlsx或*.xls格式文件!");
                    return;
                }
                $.ajax({
                    url: root.goodsInter.goods_exceldata,
                    timeout : 900000, //超时时间设置，单位毫秒
                    type: "POST",
                    contentType: 'multipart/form-data',
                    data: formData,
                    // 告诉jQuery不要去处理发送的数据
                    processData: false,
                    // 告诉jQuery不要去设置Content-Type请求头
                    contentType: false,
                    beforeSend: function () {
                        $("#productLoding").show();
                    },
                    success: function (data) {
                        $("#productLoding").hide();
                        if (data.errorCode == 0) {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html("导入商品信息完成，导入详情请下载异常商品信息");
                        } else {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html(data.errorMessage);
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $("#productLoding").hide();
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("系统服务异常!");
                    }
                })
            }
        });

        /*商品下载*/
        $("#dwProductLoad").click(function () {
            window.location.href = root.goodsInter.goods_expProduct
        });

        /*异常商品下载*/
        $("#dwErrorProductLoad").click(function () {
            dwImportErrorMsg(1) ;
        });

        var dwImportErrorMsg = function (errorBillPrefix) {
            var creationBy = JsonObject.user.user_ID ;
            window.location.href = root.goodsInter.goods_expErrorMsg+"?errorBillPrefix="+errorBillPrefix+"&creationBy="+creationBy ;
        }
        /**
         * 最小起订量导入
         */

        /*商品上传*/
        $('#upSkuMiniOrderLoad').click(function () {
            if (!$("#SkuMiniOrderLoding").is(":hidden")) {
                $("#dizhi").modal("show");
                $("#dataMessage").html("文件上传未结束...");
                return;
            }
            var formData = new FormData();
            var name = $("#upSkuMiniOrderFile").val();//文件名称
            formData.append("file", $("#upSkuMiniOrderFile")[0].files[0]);
            formData.append("creationBy", JsonObject.user.user_ID);
            formData.append("lastModifiedBy", JsonObject.user.user_ID);
            if ($("#upSkuMiniOrderFile")[0].files[0] == null || $("#upSkuMiniOrderFile")[0].files[0] == '') {
                $("#dizhi").modal("show");
                $("#dataMessage").html("请选择上传的Excel文件!");
                return;
            } else {
                var result = /\.[^\.]+/.exec(name);
                if (result != ".xlsx" && result != ".xls") {
                    $("#dizhi").modal("show");
                    $("#dataMessage").html("上传的文件格式错误，请传递*.xlsx或*.xls格式文件!");
                    return;
                }
                $.ajax({
                    url: root.goodsInter.goods_excelminiorderdata,
                    type: "POST",
                    contentType: 'multipart/form-data',
                    data: formData,
                    // 告诉jQuery不要去处理发送的数据
                    processData: false,
                    // 告诉jQuery不要去设置Content-Type请求头
                    contentType: false,
                    beforeSend: function () {
                        $("#SkuMiniOrderLoding").show();
                    },
                    success: function (data) {
                        $("#SkuMiniOrderLoding").hide();
                        $("#dizhi").modal("show");
                        $("#dataMessage").html(data.msg);
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $("#SkuMiniOrderLoding").hide();
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("系统服务异常!");
                    }
                })
            }
        });

        /*最小起订量下载*/
        $("#dwSkuMiniOrderLoad").click(function () {
            window.location.href = root.goodsInter.goods_expminiorder
        });

        /*异常最小起订量下载*/
        $("#dwErrorSkuMiniOrderLoad").click(function () {
            dwImportErrorMsg(3) ;
        });

         /**
         * 最小起订量导入END
         */

        /**
         * 指定展示价和锁价类型导入
         */
        $('#upSkuPriceTypeFileLoad').click(function () {
            if (!$("#skuSkuPriceTypeLoding").is(":hidden")) {
                $("#dizhi").modal("show");
                $("#dataMessage").html("文件上传未结束...");
                return;
            }
            var formData = new FormData();
            var name = $("#upSkuPriceTypeFile").val();//文件名称
            formData.append("file", $("#upSkuPriceTypeFile")[0].files[0]);
            formData.append("creationBy", JsonObject.user.user_ID);
            formData.append("lastModifiedBy", JsonObject.user.user_ID);
            if ($("#upSkuPriceTypeFile")[0].files[0] == null || $("#upSkuPriceTypeFile")[0].files[0] == '') {
                $("#dizhi").modal("show");
                $("#dataMessage").html("请选择上传的Excel文件!");
                return;
            } else {
                var result = /\.[^\.]+/.exec(name);
                if (result != ".xlsx" && result != ".xls") {
                    $("#dizhi").modal("show");
                    $("#dataMessage").html("上传的文件格式错误，请传递*.xlsx或*.xls格式文件!");
                    return;
                }
                $.ajax({
                    url: root.goodsInter.goods_importPriceType,
//                    url: 'http://localhost:7050/aproduct/importPrice/importPriceType',
                    type: "POST",
                    contentType: 'multipart/form-data',
                    data: formData,
                    // 告诉jQuery不要去处理发送的数据
                    processData: false,
                    // 告诉jQuery不要去设置Content-Type请求头
                    contentType: false,
                    beforeSend: function () {
                        $("#skuSkuPriceTypeLoding").show();
                    },
                    success: function (data) {
                        $("#skuSkuPriceTypeLoding").hide();
                        if (data.errorCode == 0) {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html("导入成功");
                        }else if (data.errorCode == "1010024") {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html(data.errorMessage);
                        }else {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html(data.errorMessage + ' </br>');
                            $("#dataMessage").html('异常!' + ' </br>');
                            $.each(data.errorList, function (index, val) {
                                $("#dataMessage").append(val + ' </br>');
                            })
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $("#skuSkuPriceTypeLoding").hide();
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("系统服务异常!");
                    }
                })
            }
        });

        $("#dwSkuPriceTypeFileLoad").click(function () {
            window.location.href = root.goodsInter.goods_exPriceType;
//            window.location.href = 'http://localhost:7050/aproduct/importPrice/exPriceType';
        });

        /**
         *指定交易价锁价类型导入
         */
        $('#upSkuTranPriceTypeFileLoad').click(function () {
            if (!$("#skuSkuTranPriceTypeLoding").is(":hidden")) {
                $("#dizhi").modal("show");
                $("#dataMessage").html("文件上传未结束...");
                return;
            }
            var formData = new FormData();
            var name = $("#upSkuTranPriceTypeFile").val();//文件名称
            formData.append("file", $("#upSkuTranPriceTypeFile")[0].files[0]);
            formData.append("creationBy", JsonObject.user.user_ID);
            formData.append("lastModifiedBy", JsonObject.user.user_ID);
            if ($("#upSkuTranPriceTypeFile")[0].files[0] == null || $("#upSkuTranPriceTypeFile")[0].files[0] == '') {
                $("#dizhi").modal("show");
                $("#dataMessage").html("请选择上传的Excel文件!");
                return;
            } else {
                var result = /\.[^\.]+/.exec(name);
                if (result != ".xlsx" && result != ".xls") {
                    $("#dizhi").modal("show");
                    $("#dataMessage").html("上传的文件格式错误，请传递*.xlsx或*.xls格式文件!");
                    return;
                }
                $.ajax({
                    url: root.goodsInter.goods_importTranPriceType,
//                    url: 'http://localhost:7050/aproduct/importPrice/importTranPriceType',
                    type: "POST",
                    contentType: 'multipart/form-data',
                    data: formData,
                    // 告诉jQuery不要去处理发送的数据
                    processData: false,
                    // 告诉jQuery不要去设置Content-Type请求头
                    contentType: false,
                    beforeSend: function () {
                        $("#skuSkuTranPriceTypeLoding").show();
                    },
                    success: function (data) {
                        $("#skuSkuTranPriceTypeLoding").hide();
                        if (data.errorCode == 0) {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html("导入成功");
                        } else {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html(data.errorMessage + ' </br>');
                            $("#dataMessage").html('异常!' + ' </br>');
                            $.each(data.errorList, function (index, val) {
                                $("#dataMessage").append(val + ' </br>');
                            })
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $("#skuSkuTranPriceTypeLoding").hide();
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("系统服务异常!");
                    }
                })
            }
        });

        $("#dwSkuTranPriceTypeFileLoad").click(function () {
            window.location.href = root.goodsInter.goods_expTranPriceType;
//            window.location.href = 'http://localhost:7050/aproduct/importPrice/expTranPriceType';
        });

        /**
         * 库存初始化
         */
        $("#initStockLoad").click(function () {
            if (!$("#stockInitLoding").is(":hidden")) {
                $("#dizhi").modal("show");
                $("#dataMessage").html("库存初始化未结束...");
                return;
            }
            $.ajax({
                url: root.goodsInter.goods_stockSynchronization,
//                url: 'http://localhost:7050/aproduct/product/stock/stockSynchronization',
                type: "POST",
                contentType: 'multipart/form-data',
                // 告诉jQuery不要去处理发送的数据
                processData: false,
                // 告诉jQuery不要去设置Content-Type请求头
                contentType: false,
                beforeSend: function () {
                    $("#stockInitLoding").show();
                },
                success: function (data) {
                    $("#stockInitLoding").hide();
                    if (data.errorCode == 0) {
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("库存初始化成功");
                    } else {
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("库存初始化失败");
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $("#stockInitLoding").hide();
                    $("#dizhi").modal("show");
                    $("#dataMessage").html("系统服务异常!");
                }
            })
        });


        /**
         * 价格初始化
         */
        $("#initPriceLoad").click(function () {
            if (!$("#initPriceLoding").is(":hidden")) {
                $("#dizhi").modal("show");
                $("#dataMessage").html("价格初始化未结束...");
                return;
            }
            $.ajax({
                url: root.goodsInter.goods_priceSynchronization,
//                url: 'http://localhost:7050/aproduct/product/stock/stockSynchronization',
                type: "POST",
                contentType: 'multipart/form-data',
                // 告诉jQuery不要去处理发送的数据
                processData: false,
                // 告诉jQuery不要去设置Content-Type请求头
                contentType: false,
                beforeSend: function () {
                    $("#initPriceLoding").show();
                },
                success: function (data) {
                    $("#initPriceLoding").hide();
                    if (data.errorCode == 0) {
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("价格初始化成功");
                    } else {
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("价格初始化失败");
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $("#initPriceLoding").hide();
                    $("#dizhi").modal("show");
                    $("#dataMessage").html("系统服务异常!");
                }
            })
        });

        // 商品上下架导入
        $('#upSkuShelfTypeFileLoad').click(function () {
            if (!$("#skuSkuShelfTypeLoding").is(":hidden")) {
                $("#dizhi").modal("show");
                $("#dataMessage").html("文件上传未结束...");
                return;
            }
            var formData = new FormData();
            var name = $("#upSkuShelfTypeFile").val();//文件名称
            formData.append("file", $("#upSkuShelfTypeFile")[0].files[0]);
            formData.append("creationBy", JsonObject.user.user_ID);
            formData.append("lastModifiedBy", JsonObject.user.user_ID);
            if ($("#upSkuShelfTypeFile")[0].files[0] == null || $("#upSkuShelfTypeFile")[0].files[0] == '') {
                $("#dizhi").modal("show");
                $("#dataMessage").html("请选择上传的Excel文件!");
                return;
            } else {
                var result = /\.[^\.]+/.exec(name);
                if (result != ".xlsx" && result != ".xls") {
                    $("#dizhi").modal("show");
                    $("#dataMessage").html("上传的文件格式错误，请传递*.xlsx或*.xls格式文件!");
                    return;
                }
                $.ajax({
                    url: root.goodsInter.goods_exceldataforSKuShelf,
                    timeout : 900000, //超时时间设置，单位毫秒
                    type: "POST",
                    contentType: 'multipart/form-data',
                    data: formData,
                    // 告诉jQuery不要去处理发送的数据
                    processData: false,
                    // 告诉jQuery不要去设置Content-Type请求头
                    contentType: false,
                    beforeSend: function () {
                        $("#skuSkuShelfTypeLoding").show();
                    },
                    success: function (data) {
                        $("#skuSkuShelfTypeLoding").hide();
                        if (data.errorCode == 0) {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html("导入完成，请下载导入商品详情查看结果");
                        } else {
                            $("#dizhi").modal("show");
                            $("#dataMessage").html(data.errorMessage + ' </br>');
                            // $("#dataMessage").html('异常!' + ' </br>');
                            $.each(data.errorList, function (index, val) {
                                $("#dataMessage").append(val + ' </br>');
                            })
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $("#skuSkuShelfTypeLoding").hide();
                        $("#dizhi").modal("show");
                        $("#dataMessage").html("系统服务异常!");
                    }
                })
            }
        });

        /*/!*异常商品下载*!/
        $("#dwSkuShelfTypeFileLoad").click(function () {
            window.location.href = root.goodsInter.goods_expErrorMsg;
        });*/
        /*异常商品下载*/
        $("#dwSkuShelfTypeFileLoad").click(function () {
            dwImportErrorMsg(2) ;
        });

        /*异常商品下载*/
        $("#dwshelfModule").click(function () {
            window.location.href = root.goodsInter.goods_expSkuShelfModule;
        });

    });

</script>
</body>
</html>